package com.koron.housing.apply.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.housing.apply.bean.po.HousingStaffHonor;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * 工作荣誉(HousingStaffHonor)表服务接口
 *
 * @author jzp
 * @since 2022-02-26 15:22:40
 */
public interface HousingStaffHonorService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    HousingStaffHonor getById(SessionFactory factory, String id);

    /**
     * 查询所有数据
     *
     * @param housingStaffHonor 查询条件对象
     * @return 列表结果集
     */
    List<HousingStaffHonor> list(SessionFactory factory, HousingStaffHonor housingStaffHonor);

    List<HousingStaffHonor> listByApplyId(SessionFactory factory, String applyId);

    /**
     * 分页查询
     *
     * @param housingStaffHonor 分页条件
     * @return 对象列表
     */
    default PageInfo<HousingStaffHonor> page(SessionFactory factory, PageQuery pageQuery, HousingStaffHonor housingStaffHonor) {
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<HousingStaffHonor> housingStaffHonorList = list(factory, housingStaffHonor);
        return new PageInfo<>(housingStaffHonorList);
    }

    /**
     * 新增数据
     *
     * @param housingStaffHonor 实例对象
     * @return 是否成功
     */
    boolean save(SessionFactory factory, HousingStaffHonor housingStaffHonor);

    boolean saveBatch(SessionFactory factory, List<HousingStaffHonor> honorList);

    /**
     * 修改数据
     *
     * @param housingStaffHonor 实例对象
     * @return 是否成功
     */
    boolean update(SessionFactory factory, HousingStaffHonor housingStaffHonor);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    boolean deleteById(SessionFactory factory, String id);

    boolean deleteBatchIds(SessionFactory factory, List<String> ids);

    boolean removeByApplyId(SessionFactory factory, String applyId);

}
